<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>作业1</title>
</head>

<body>
    <!-- 表单 -->
    <form onsubmit="return mySubmit()" action="">
        <table border="1" cellspacing="0">
            <tr>
                <td>用户名：</td>
                <td><span><input id="username" type="text" name="username"></span></td>
            </tr>
            <tr>
                <td>密&nbsp;&nbsp;&nbsp;&nbsp;码：</td>
                <td><span><input type="password" name="password"></span></td>
            </tr>
            <tr>
                <td>性&nbsp;&nbsp;&nbsp;&nbsp;别：</td>
                <td><span><input type="radio" name="sex">男<input type="radio" name="sex">女</span></td>
            </tr>
            <tr>
                <td>学&nbsp;&nbsp;&nbsp;&nbsp;历：</td>
                <td><span><input type="radio" name="background">本科<input type="radio" name="background">专科</span></td>
            </tr>
            <tr>
                <td>自我介绍：</td>
                <td><textarea name="intro" id="intro" cols="30" rows="10"></textarea></td>
            </tr>
            <tr>
                <td colspan="2" align="center">
                        <button>提交</button>
                </td>
            </tr>
        </table>
    </form>
    
    <script>
        function mySubmit() {
            var username = document.getElementById("username").value;
            if ("admin" == username) {
                alert(document.getElementById("intro").value);
            } else {
                alert("输入的用户名不正确，请重新输入！")

            }
            //取消表单提交
            return false;
        }
    </script>

</body>

</html>